import type { RouteRecordRaw } from 'vue-router'
import SiteLayout from '@/layout/index.vue'
import userRoutes from './user'
import settingRoutes from './setting'

const routes: RouteRecordRaw[] = [
  {
    path: '/',
    component: SiteLayout,
    children: [
      {
        path: 'dashboard',
        component: () => import('@/views/dashboard/index.vue'),
        meta: {
          title: '仪表盘',
        },
      },
      {
        path: 'banner',
        component: () => import('@/views/banner/index.vue'),
        meta: {
          title: '轮播图管理',
        },
      }
    ],
  },
  ...userRoutes,
  ...settingRoutes,
  {
    path: '/workbench',
    component: SiteLayout,
    children: [
      {
        path: 'echarts',
        component: () => import('@/views/workbench/charts.vue'),
        meta: {
          title: '可视化图表',
        },
      },
      {
        path: 'rich-editor',
        component: () => import('@/views/workbench/rich-editor.vue'),
        meta: {
          title: '富文本编辑器',
        },
      },
      {
        path: 'map',
        component: () => import('@/views/workbench/map.vue'),
        meta: {
          title: '地图',
        },
      },
    ],
  },
  {
    path: '/login',
    component: () => import('@/views/login/index.vue'),
  },
  {
    path: '/:pathMatch(.*)*',
    component: () => import('@/views/not-found/index.vue'),
  },
]

export default routes